/**
 * 
 * @authors Your Name (you@example.org)
 * @date    2018-11-23 10:29:00
 * @version $Id$
 */

var $ = jquery = layui.jquery;
var layer = layui.layer;

$("#addClassifyBt").click(function() {
	layer.open({
		type: 1,
		title: "添加分类",
		content: $('#controlAddClassify'),
		area: ["500px", "300px"],
		btn: ['确定', '取消'],
		yes: function(index, layero) {
			var requestUrl = commonParams.domain_path + '/Manage/book/addBookClass';
			var class_name = $('#controlAddClassify').find("input").val().trim();
			if (class_name.length == 0) {
				layer.msg("分类名称不能为空！");
			} else {
				requestData = 'class_name=' + class_name;
				AjaxForJson(requestUrl, requestData, function(obj) {
					if ("success" == obj.type) {
						layer.msg(obj.message);
					}
				}, null, null);
			}
			layer.close(index);
		}
	});
})


$("body").on("click", "#classifyTable .del", function() {
	layer.confirm('确定删除此条吗?', {
		icon: 3,
		title: '提示'
	}, function(index) {
		alert("点击了确认");
		layer.close(index);
	});
})